//
//  ViewController.m
//  03_Work
//
//  Created by dllo on 16/7/18.
//  Copyright © 2016年 yh. All rights reserved.
//

#import "ViewController.h"
#import "LabelView.h"
#import "ImageViewButton.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    // 通过UILabel封装实现只显示文字的Button
    // 通过UIImageView封装实现只显示图片的Button 以上两种方式, 要考虑到通用性。
    // 使用自己封装的控件, 加入到前两天编写的登陆页中
    // 1. labelButton
    self.view.backgroundColor = [UIColor cyanColor];
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)];
    UILabel *label = [LabelView labelWithView:self.view frame:CGRectMake(20, 50, 80, 30) labelName:@"笑一个呗" tap:tap];
    label.userInteractionEnabled = YES;
    [self.view addSubview:label];
    
    // 2. imageViewButton
    UITapGestureRecognizer *imageTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageButtonAction:)];
    UIImageView *imageView = [ImageViewButton createImageViewButtonFrame:CGRectMake(20, 100, 150, 250) view:self.view image:[UIImage imageNamed:@"u=2451099015,3197360487&fm=21&gp=0.jpg"] tap:imageTap];
    [self.view addSubview:imageView];
    imageView.userInteractionEnabled = YES;

}

- (void)tapAction:(UITapGestureRecognizer *)tap {
    NSLog(@"哈哈哈哈哈");
}

- (void)imageButtonAction:(UITapGestureRecognizer *)tap {
    NSLog(@"我最可爱 哼");
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
